package com.example.Mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.example.pojo.Belaidup;
import com.example.pojo.BillAccount;
import com.example.pojo.BillAccount_detail;

public interface BillAccountDao {
	/**
	 * 分页查询应付冲款主表
	 * @param begin
	 * @param end
	 * @return
	 */
	@Select("select *,d.deptname as 'DeptFrom.deptname',g.gysname as 'CustomerID.gysname' from billaccount "
			+ "inner join dept d on billaccount.DeptFrom=d.deptid "
			+ " inner join gongyingshang g on  billaccount.CustomerID=g.gysid"
			+ " LIMIT #{begin},#{end}")
	List<BillAccount> billAccountAll(@Param("begin") int begin,@Param("end") int end);
	/**
	 * 查询应付冲款主表总记录数
	 * @return
	 */
	@Select("select count(*) from billaccount")
	int sumCount();
	/**
	 * 查询应付冲款单详表
	 * @param BillAccountID
	 * @return
	 */
	@Select("select *,d.deptname as 'DeptID.deptname' from BillAccount_detail b "
		+ " inner join dept d on b.DeptID=d.deptid where b.BillAccountID=#{BillAccountID}")
	List<BillAccount_detail> account_detailsByNo(@Param("BillAccountID")String BillAccountID);
	/**
	 * 按编号查询供应商
	 * @param CustID
	 * @return
	 */
	@Select("select * from belaidup where custID=#{CustID}")
	List<Belaidup>  findBelaidupByno(@Param("CustID")String CustID);
}
